#include<iostream>
using namespace std;

class Person
{
protected:
	string m_name;
	int m_age;
public:
	Person(const string& name = "", int age = 0) :
		m_name(name), m_age(age) {}
	virtual ~Person() = default;

	const string& name()const
	{
		return m_name;
	}

	int age()const
	{
		return m_age;
	}
	void plusOneYear()
	{
		++m_age;
	}

};
class Course
{
	string m_name;
	int m_score;
public:
	Course(const string& name = "", int score = 0) :
		m_name(name), m_score(score) {}
	void setScore(int score)
	{
		m_score = score;
	}
	int score()const
	{
		return m_score;
	}
	const string& name()const {
		return m_name;
	}
};
class Student final :public Person
{
private:
	Course m_course;
public:
	Student(const string& name, int age, const Course& c) :
		Person(name, age), m_course(c) {}
	Course& course()
	{
		return m_course;
	}

};
class PartTimeWorker final :public Person
{
private:
	double m_hour;
	static double ms_payRate;

public:
	PartTimeWorker(const string& name, int age, double h = 0) :
		Person(name, age), m_hour(h)
	{}
	void setHours(double h)
	{
		m_hour = h;
	}
	double salary()
	{
		return m_hour * ms_payRate;
	}

};

double PartTimeWorker::ms_payRate = 7.53;


class Base
{
public:
	void foo()
	{
		cout << "Base::foo" << endl;
	}
};
class Derived : public Base
{
public:
	void foo()
	{
		cout << "Derived::foo " << endl;
	}

};
int main()
{
	Derived d;
	d.foo();
	d.Base::foo();
}